﻿<!--#INCLUDE FILE="config.asp"-->

<%
if(Session("SalesAccessLevel") <> 4 ) then
	Response.Redirect("default.asp")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- DATE PICKER SCRIPT -->
<link type="text/css" href="../css/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript">
	// ***** Session Timeout Warning and Redirect mReschke 2010-09-29 ***** //
function InitSessionTimer() {
    /* mReschke 2010-09-29 */
    warn_sec = <%=session.timeout%> * 60 * 1000;   	//Warning time in milliseconds
    timeout_sec = <%=session.timeout%> * 60 * 1000 + 60000;          //Actual timeout in milliseconds
    show_warning = true;
    epoch = new Date().getTime();
    CheckSessionStatus();
}
InitSessionTimer();
function CheckSessionStatus() {
    /* mReschke 2010-09-29 */
 
    //Check for session warning
    epoch2 = new Date().getTime();
     if (epoch2 > epoch + timeout_sec) {
        alert("Your session has timed out.");
        window.location.href = 'default.asp?msg=invalid_out';
    } else {
        down = setTimeout("CheckSessionStatus();", 2000);
    }
}
</script>
<script>
	$(function() {
		$( "#arrival1" ).datepicker();
		$( "#departure1" ).datepicker();
		$( "#arrival2" ).datepicker();
		$( "#departure2" ).datepicker();
	});
	</script>
  <!-- END DATE PICKER SCRIPT -->

<script> 
  //$(document).ready(function(){
  //$('.dashboad_wrapper tr:nth-child(odd)').addClass('alternate');
//});
</script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
    $('#list_table tr:nth-child(2n+1)').addClass('alternate');
});
</script>

  <script language="javascript" type="text/javascript">
function checkValidation()
{
	if(document.getElementById('firstname').value =="")
	{
		alert("Enter First Name");
		document.getElementById('firstname').focus();
		return false;
	}
	if(document.getElementById('lastname').value =="")
	{
		alert("Enter Last Name");
		document.getElementById('lastname').focus();
		return false;
	}
	if(document.getElementById('phonenumber').value =="")
	{
		alert("Enter phone number");
		document.getElementById('phonenumber').focus();
		return false;
	}
	if(document.getElementById('email').value =="")
	{
		alert("Enter Email");
		document.getElementById('email').focus();
		return false;
	}
	if(document.getElementById('username').value =="")
	{
		alert("Enter User Name");
		document.getElementById('username').focus();
		return false;
	}
	
	if(document.getElementById('password').value =="")
	{
		alert("Enter Password");
		document.getElementById('password').focus();
		return false;
	}
	return true;
}
</script>


<title>Agente/Sales Agent :: CostaBaja</title>

</head>

<body>
<%
	if(request("sId") <> "") then
		SaleID = request("sId")
	else 
		SaleID = 0
	end if
	
	strQuery = "SELECT TOP 1 * FROM Sales WHERE Sales.SaleID ="& SaleID
	
	set objConnect1 = server.createObject("ADODB.Connection")   

	objConnect1.Open conStr

	set TblTemp1 = server.createobject("Adodb.Recordset")
		
		TblTemp1.Open strQuery, objConnect1
		
	If not TblTemp1.EOF Then
			SaleID = TblTemp1("SaleID")
			FirstName = TblTemp1("FirstName")
			LastName = TblTemp1("LastName")
			PhoneNumber = TblTemp1("PhoneNumber")
			CellNumber = TblTemp1("CellNumber")
			Email = TblTemp1("Email")
			EmailPassword = TblTemp1("EmailPassword")
			UserName = TblTemp1("UserName")
			Password = TblTemp1("Password")
			Active = TblTemp1("Active")
			SalesAgent = TblTemp1("SalesAgent")
	end if	
%>
<div id="main_wrapper">
    	<div class="main_wrapper_margin">
        	
            <div class="admin_top_menu">
            <!--#INCLUDE FILE="sales_people_menu.asp"--> 
           	</div><!-- END admin_top_menu -->
             
			<h1>Agente/Sales Agent</h1>
            <div class="clear"></div>
            
            
            
            <div class="dashboad_wrapper">
              
                   <fieldset>
           	<legend>Información de Agente/Agent Info</legend>
              <form action="sales-edit-salesperson-process.asp" method="post" id="editsalesperson">
              
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    <label>Nombre/First Name:</label><br />
<input name="firstname" id="firstname" value="<%=FirstName%>" type="text" />    	
    </td>
    <td>
       <label>Apellido/Last Name:</label><br />
<input name="lastname" id="lastname" value="<%=LastName%>" type="text" />    	
    </td>
  </tr>
  
    <tr>
    <td>
<label>Telefono/Phone:</label><br />
<input name="phonenumber" id="phonenumber" value="<%=PhoneNumber%>" type="text" /> 
    </td>
    <td>
<label>Numero Móvil/Cell:</label><br />
<input name="cell" id="cell" value="<%=CellNumber%>" type="text" /> 
    </td>
  </tr>
  
  <tr>
    <td>
    <label>Email:</label><br />
<input name="email" id="email" value="<%=Email%>" type="text" />   </td>
    <td>
  <label>Email Password:</label><br />
<input name="emailpassword" id="emailpassword" value="<%=EmailPassword%>" type="password" />   
    </td>
  </tr>
  <tr>
    <td>
        <label>Nombre Usuario/User Name:</label><br />
<input name="username" id="username" value="<%=UserName%>" type="text" />   </td>
    <td>
  <label>Password:</label><br />
<input name="password" id="password" value="<%=Password%>" type="password" />   
    </td>
  </tr>
  <tr>  
    <td>
        <label>Agente de Ventas/Sales Agent:</label><br />
		<input name="salesagent" id="salesagent" value="<%=SalesAgent%>" type="text" />
		</td>
	<td>
	<label>Remove and Transfer: </label><br/>
	<select name="newsale" id="newsale">
		<option value="-1">None</option>
		<%
			if(request("sId") <> "") then
				slID = request("sId")
			else 
				slID = 0
			end if
			strQuery2 = "SELECT SaleID,FirstName,LastName FROM Sales WHERE SaleID <> " + slID
			set objConnect2 = server.createObject("ADODB.Connection")   

			objConnect2.Open conStr

			set TblTemp2 = server.createobject("Adodb.Recordset")
				
				TblTemp2.Open strQuery2, objConnect2
				
				Do Until TblTemp2.EOF
					SaID = TblTemp2("SaleID")
					Name = TblTemp2("FirstName") + " " + TblTemp2("LastName") 
			%>
			<option value="<%=SaID%>"><%=Name%></option>
			<%
				TblTemp2.MoveNext
				Loop
		%>
	</select>
	</td>
  </tr>
  <tr>
    <input type="hidden" name="sId" id="sId" value="<%=SaleID%>" />
    <td colspan="2"><input name="" type="submit" value="Editar/Edit" onclick="javascript:return checkValidation();"/>
	</td> 
  </tr>
</table>
             
 
 

</form>
</fieldset>

            </div><!-- .dashboad_wrapper -->
                        
    	</div><!-- END .main_wrapper_margin -->
        
	</div><!-- END #main_wrapper -->

         <!-- FOOTER -->
         
         <!--#INCLUDE file="sales_footer.asp"-->
         
         <!-- END FOOTER -->   

</body>
</html>
